{% extends 'basic.html' %}

{% block header %}
<h1>Zarządzaj wypożyczeniami<small> wszystkich użytkowników</small></h1>
{% endblock %}

{% block content %}
<form id="filter_form" class="navbar-search">
    <div class="input-append btn-group"-->
        <input id="filter" name="filter" class="span5" type="text" data-provide="typeahead" autocomplete="off" placeholder="Filtruj po autorze, tytule, czytelniku...">
        <button type="submit" class="btn">Filtruj</button>
        <button type="reset" class="btn clear">Wyczyść</button>
    </div>
</form>
<table id="orders" class="table table-hover">
    <thead>
        <tr>
            <th>Pozycja</th>
            <th>Data zwrotu</th>
            <th>Akcja</th>
        </tr>
    </thead>
    {% for u in users %}
    <tbody>
        <tr>
            <td colspan="3">{{u}}</td>
        </tr>
        {% for order in u.order_set.all %}
        <tr>
            <td>
                {{order.item.media.as_icon|safe}} {{order.item.title}}, {{order.item.author}}
            </td>
            <td>{{order.due_date}}</td>
            <td>
                <div class="btn-group" data-value="{{order.pk}}">
                    <button class="btn" data-type='back' type="button">Zwróć</button>
                    <button class="btn" data-type="prelong" type="button">Prelonguj</button>
                </div>
            </td>
        </tr>
        {% endfor %}
    </tbody>
    {% endfor %}
</table>
{% endblock %}

{% block sidebar %}
    <div class="well">
    Użytkowników szukaj po ich adresach email
    </div>
{% endblock %}
